Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Transcode Quality #371

Merged
merged 12 commits into from
Aug 30, 2023
Merged

Improve Transcode Quality #371

merged 12 commits into from
Aug 30, 2023

Conversation

leszko
Copy link
Contributor

@leszko leszko commented Aug 29, 2023

Improve Transcode Quality with:

  • Always setting -preset slow -tier high
  • Allowing setting CRF (CQ) to use constant rate factor instead of constant bitrate

Note that there will be a separate PR to change scale_cuda to scale_npp.

Related:

@leszko leszko requested review from Thulinma, thomshutt and emranemran and removed request for emranemran August 29, 2023 10:42
@leszko
Copy link
Contributor Author

leszko commented Aug 30, 2023

CI is failing, but it's unrelated to this PR, failing also on master: https://github.com/livepeer/lpms/actions/runs/6022454830/job/16337223769?pr=372

@leszko leszko merged commit e8052f0 into master Aug 30, 2023
1 check failed
@leszko leszko deleted the rafal/transcode-quality-params branch August 30, 2023 12:09

// There's no direct numerical correspondence between CQ and CRF.
// From some experiments, it seems that setting CQ = CRF + 7 gives similar visual effects.
cq := p.Profile.CRF + 7
Copy link

@emranemran emranemran Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you end up with this formula? Lower CQ values typically indicate better quality at expense of compressions. Also encoders typically will pick either CQ and CRF as the main control so I'm not sure if CQ here will actually make a difference. Do you see a difference if we leave out CQ changes here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRF is used by CPU-based transcoding, CQ is used by GPU-based transcoding.
So, only one of these values will be used at the time.

Technically there is no direct numerical correspondence between CQ and CRF, so the other option would be to set both CRF and CQ in our API. But I think it's not a pragmatic approach right now. Most of our transcoders are GPU anyway.

How did I come with cq := p.Profile.CRF + 7, just experimenting with videos. But obviously not for all videos it will give the same results, since technically CRF and CQ values do not correspond to each other.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cq := p.Profile.CRF + 7 doesn't quite make sense to me esp since they don't correspond to one another. Also if CRF is CPU only, then why do we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliteprox pushed a commit to eliteprox/lpms that referenced this pull request Nov 2, 2023
Add params:
- `-preset slow`
- `-tier high`
- `-cq` / `-crf`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants